/*
package com.dony.store.service.impl;

import com.alibaba.fastjson2.JSONObject;
import com.dony.store.domain.enums.LazadaCountryEnum;
import com.lazada.lazop.api.LazopClient;
import com.lazada.lazop.api.LazopRequest;
import com.lazada.lazop.api.LazopResponse;
import com.lazada.lazop.util.ApiException;
import com.dony.common.core.redis.RedisCache;
import com.dony.common.utils.SecurityUtils;
import com.dony.common.utils.StringUtils;
import com.dony.store.service.LazadaService;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class LazadaServiceImpl implements LazadaService {

    @Value("${lazada.appKey}")
    private String appKey;

    @Value("${lazada.appSecret}")
    private String appSecret;

    @Value("${lazada.authUrl}")
    private String authUrl;

    @Value("${lazada.callBackUrl}")
    private String callBackUrl;

    @Resource
    private RedisCache redisCache;

    @Value("${lazada.url.}")


    */
/**
     * 生成授权url
     * @return
     *//*

    @Override
    public String createAccessTokenUrl() {
        return "https://auth.lazada.com/oauth/authorize?response_type=code&force_auth=true&redirect_uri=" + callBackUrl + "&client_id=" + appKey;
    }

    */
/**
     * 获取lazada授权链接
     *//*

    @Override
    public String getAccessToken(String code) throws ApiException {
        LazopClient client = new LazopClient("https://auth.lazada.com/rest", appKey, appSecret);
        LazopRequest request = new LazopRequest("/auth/token/create");
        request.addApiParameter("code", "0_104512_bAQKwVS4PyXFYyuMfmNYjZlu2636");
        LazopResponse response = client.execute(request);
        System.out.println(response.getBody());
        // 将access token存在缓存中
        Long userId = SecurityUtils.getUserId();
        if (userId == null) {
            userId = 1L;
        }
        redisCache.setCacheObject(String.valueOf(userId) , response.getBody());
        return response.getBody();
    }

    */
/**
     * 获取订单
     * @return
     *//*

    @Override
    public String getOrderList() {
        Long userId = SecurityUtils.getUserId();
        if (userId == null) {
            userId = 1L;
        }
        String tokenObject = redisCache.getCacheObject(String.valueOf(userId));
        if (StringUtils.isEmpty(tokenObject)) {
            return null;
        }
        JSONObject jsonObject = JSONObject.parseObject(tokenObject);
        String country = jsonObject.getString("country");
        if (StringUtils.isEmpty(country)) {
            return null;
        }
        String accessToken = jsonObject.getString("access_token");
        String url = LazadaCountryEnum.getUrl(country);


        LazopClient client = new LazopClient(url, appKey, appSecret);
        LazopRequest request = new LazopRequest();
        request.setApiName("/orders/get");
        request.setHttpMethod("GET");
        request.addApiParameter("update_before", "2022-02-10T16:00:00+08:00");
        request.addApiParameter("sort_direction", "DESC");
        request.addApiParameter("offset", "0");
        request.addApiParameter("limit", "10");
        request.addApiParameter("update_after", "2017-02-10T09:00:00+08:00");
        request.addApiParameter("sort_by", "updated_at");
        request.addApiParameter("created_before", "2022-02-10T16:00:00+08:00");
        request.addApiParameter("created_after", "2017-02-10T09:00:00+08:00");
//        request.addApiParameter("status", "shipped");
        LazopResponse response = null;
        try {
            response = client.execute(request, accessToken);
        } catch (ApiException e) {
            e.printStackTrace();
        }
        System.out.println(response.getBody());
        return response.getBody();
    }
}
*/
